# from django.test import TestCase

# Create your tests here.4

# 初始化
import os
from datetime import date

import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "perfect_syl.settings")
django.setup()
from app_models.models import BookInfo, HeroInfo
'''
注意：一定要把 导包：from app_models.models import BookInfo, HeroInfo，
放在 django.setup()，否则会报错：django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
也就是引用程序还没有加载
'''

# books = BookInfo.objects.all()
# #对与all()操作，转化成sql语句
# print(books.query)
# print(books)
#
# books = BookInfo.objects.filter(btitle='天龙八部')
# #对与all()操作，转化成sql语句
# print(books.query)
# print(books)


#管理yuan
# username:admin86177
#Email:没写
# password  qwe86177


# book = BookInfo(
#     btitle='西游记',
#     bpub_date=date(1988,1,1),
#     bread=10,
#     bcomment=10
# )
# book.save()
#
# print(book)

# books=BookInfo.objects.exclude(id=1)
# print(books.query)
# for book in books:
#     print(book)
#
# for book in books:
#     print(book)


# books=BookInfo.objects.exclude(id=1)
# print(books)
# books=BookInfo.objects.exclude(id=1)
# print(books)

#自定义 manager
book = BookInfo.objects.all()
print(book)
